import { $Http } from '@/config/service/http';

export enum Api {
  dataPermissionPage = '/dms/archivesDataPermission/page', // 数据权限管理列表
  authorityManageSave = '/dms/archiveFilePermission/save', // 保存
  archiveFilePermissionGet = '/dms/archivesDataPermission/get', // 详情
  generateCode = '/system/sequence/rule/generateCode', // 生成编码[SYSTEM-CODE-RULE-001]
  roleList = '/system/role/list', // 角色列表[SYSTEM-ROLE-005]
  typeTree = '/dms/archives/type/tree', // 查询档案类型树
  dataPermissionSave = '/dms/archivesDataPermission/save', // 编辑
}

export const CODE_RULE = {
  WJJSBM: 'DMSFT01' // 文件权限管理-文件角色编码
};

export const dataPermissionPage = (params) => {
  return $Http.api(Api.dataPermissionPage, params, 'post');
};

/**
 * 详情
 * @param params
 * id
 */
export const archiveFilePermissionGet = (id, params) => {
  return $Http.api(Api.archiveFilePermissionGet + '/' + id, params, 'get');
};

/**
 * 保存
 * @param params
 * ids
 */
export const authorityManageSave = (params) => {
  return $Http.api(Api.authorityManageSave, params, 'post');
};

/**
 * 生成编码[SYSTEM-CODE-RULE-001]
 * @param params
 */
export const generateCode = (params) => {
  return $Http.api(Api.generateCode, params, 'post');
};

/**
 * 角色列表[SYSTEM-ROLE-005]
 * @param params
 */
export const roleList = (params) => {
  return $Http.api(Api.roleList, params, 'post');
};

/**
 * 查询档案类型树
 * @param params
 */
export const typeTree = (params) => {
  return $Http.api(Api.typeTree, params, 'post');
};

export const dataPermissionSave = (params) => {
  return $Http.api(Api.dataPermissionSave, params, 'post');
};
